package com.seeyon.kk.utils.httpsUtils;

import org.springframework.web.client.RestTemplate;

/**
 * @description: 使用 RestTemplete 连接 http/https 地址
 * 参考链接：https://stackoverflow.com/questions/17619871/access-https-rest-service-using-spring-resttemplate
 * @author: chenmihui
 * @since: 2018-09-12 10:02
 *
 *
 */
public class RestTempleteConfig {
    private RestTemplate httpRestTemplate;
    private RestTemplate httpsRestTemplate;

    public void init() {
        this.httpsRestTemplate = new RestTemplate(new HttpsClientRequestFactory());
        this.httpRestTemplate = new RestTemplate();
    }

    public RestTempleteConfig(){
        this.httpsRestTemplate = new RestTemplate(new HttpsClientRequestFactory());
        this.httpRestTemplate = new RestTemplate();
    }

    public RestTemplate getHttpRestTemplate() {
        return httpRestTemplate;
    }

    public void setHttpRestTemplate(RestTemplate httpRestTemplate) {
        this.httpRestTemplate = httpRestTemplate;
    }

    public RestTemplate getHttpsRestTemplate() {
        return httpsRestTemplate;
    }

    public void setHttpsRestTemplate(RestTemplate httpsRestTemplate) {
        this.httpsRestTemplate = httpsRestTemplate;
    }
}